let uu = document.querySelector('ul');
let lis = uu.querySelectorAll('li');
let flag = true;
let productId = 0;
function render(){
    fetch("http://chst.vip:1234/api/getinlanddiscount")
        .then(body=>body.json())
        .then(res =>{
            res.result.forEach(item => {
                let result = res.result;
                uu.innerHTML +=`
                 <li ${item.productId}>
                 <a href="inlanddiscount1.html?productid=${item.productId}">
                 <div class="image">
                 ${item.productImg}
                 </div>
                 <div class="title">
                 ${item.productName}
                 </div>
                 <p class="price">${item.productPrice}</p>
                 <p class="from">${item.productFrom}</p>
                 </a>
                 </li>
                 `
            });

        })
}
 render();
document.onscroll = function () {
    let st = document.documentElement.scrollTop;
    let sh = document.documentElement.scrollHeight;
    let ch = document.documentElement.clientHeight;
    let yu = sh - (ch + st);
    if (yu < 40 && flag) {
        flag = false;
        productId++;
        if( productId > 1 ) {
            return;
        }
        render()
    } else if( yu > 40) {
        flag = true;
    }
}   